<?php

/**
 * Joomla! 1.5 component arts_curriculum
 * @package    arts_curriculum
 * @subpackage
 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on 31-August-2009
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');
/**
 * HTML View class for the arts_curriculum component
 *
 * @static
 * @package Arts_curriculum
 * Revised 12/7/09
 */
class Arts_curriculumViewVocab_Item extends JView
{
	function display($tpl = null)
	{
		global $mainframe, $option;
		$row =& JTable::getInstance('Vocab_Item', 'Table');
		$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
		$id = $cid[0];
		$row->load($id);
		
		//initialize an array
		$lists = array();
		// get the db connector
		$db =& JFactory::getDBO();
	    // build the html select list for ordering & cat changes
		$query = 'SELECT ordering AS value, title AS text'
		. ' FROM #__arts_curriculum_vocab'
		. ' WHERE catid = ' . (int) $item->catid
		. ' ORDER BY ordering';
		$lists['ordering'] = JHTML::_('list.specificordering', $item, $item->id, $query, 1 );
		$lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $item->catid ) );
		$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $item->published );
	    
				
		// make sure we're good with cats
		Arts_curriculumHelper::checkCategories() ;
				
		//some stuff well need
		$uri =& JFactory::getURI();
		$user =& JFactory::getUser();
		
		// $model =& $this->getModel( 'vocab' );
// 		$isNew = ($row->id < 1);
// 		// fail if checked out - we have a mmebr function in the controller that supports this
// 		if ($model->isCheckedOut( $user->get('id') )) {
// 			$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The list' ), $row->title );
// 			$mainframe->redirect( 'index.php?option='. $option, $msg );
// 		}
// 		// Edit or Create?
// 		if (!$isNew)
// 		{
// 			$model->checkout( $user->get('id') );
// 		}
// 		else
// 		{
// 			// initialise new record
// 			$row->published = 1;
// 			//not in use but lets support it anyway.
// 			$row->order = 0;
// 			$row>catid = JRequest::getVar( 'catid', 0, 'post', 'int' );
// 		}
// 		
		
	    //load the editor
		$editor =& JFactory::getEditor();

		//push it all to the default page
		
		$this->assignRef('row', $row);
		$this->assignRef('lists', $lists);
		$this->assignRef('editor', $editor);

		parent::display($tpl);
	   
	}
}
